﻿using SD.Infrastructure.Repository.EntityFrameworkCore;
using SlamDunk.MES.Domain.Entities.ConfigurationContext;
using SlamDunk.MES.Domain.IRepositories.Interfaces.ConfigurationContext;
using System.Collections.Generic;
using System.Linq;

namespace SlamDunk.MES.Repository.Implements.ConfigurationContext
{
    /// <summary>
    /// 用户相关储存位置仓储实现
    /// </summary>
    public class UserRelatedStorageLocationRepository : EFEntityRepositoryProvider<UserRelatedStorageLocation>, IUserRelatedStorageLocationRepository
    {
        #region # 获取用户相关储存位置列表 —— ICollection<UserRelatedStorageLocation> Find(string loginId)
        /// <summary>
        /// 获取用户相关储存位置列表
        /// </summary>
        /// <param name="loginId">用户账号</param>
        /// <returns>用户相关储存位置列表</returns>
        public ICollection<UserRelatedStorageLocation> Find(string loginId)
        {
            IQueryable<UserRelatedStorageLocation> relatedStorageLocations = base.Find(x => x.UserExtension.Number == loginId);

            return relatedStorageLocations.ToList();
        }
        #endregion
    }
}
